DO NOT MERGE: validate refresh timer cleanup test fails without fix#8134
DO NOT MERGE: validate refresh timer cleanup test fails without fix#8134jacekradko wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughA new Playwright integration test file was added at 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@integration/tests/session-token-cache/refresh-timer-cleanup.test.ts`:
- Around line 63-65: The test relies on SessionTokenCache clearing existing
refresh timers when a new token is set, but the current main omits that logic;
update the SessionTokenCache.set() implementation to cancel any existing refresh
timer for the same session/key before scheduling a new one
(clearTimeout/clearInterval on the stored timer reference), ensure the timer
reference is stored on the SessionTokenCache instance (e.g., a map of sessionId
-> refreshTimer), and start the new refresh timer only after cleaning up the
previous one so orphaned timers don't fire and the tokenRequests assertion
passes; alternatively, if you deliberately don't want the fix here, keep the
test skipped/xfail in this branch rather than merging it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4eeb25e1-884e-408a-9f81-34f3cdd7954a
📒 Files selected for processing (1)
integration/tests/session-token-cache/refresh-timer-cleanup.test.ts
| // With the fix: at most 1-2 refresh requests (one cycle at ~43s) | ||
| // Without the fix: 5+ requests from orphaned timers all firing at different offsets | ||
| expect(tokenRequests.length).toBeLessThanOrEqual(3); |
There was a problem hiding this comment.
This test is unmergeable without the matching token-cache fix.
These assertions require behavior that current main does not have yet: the SessionTokenCache.set() timer cleanup is intentionally omitted in this PR. Merging this file by itself will keep CI red, so the implementation fix needs to land with the test, or this validation test should stay skipped/xfail on this branch.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@integration/tests/session-token-cache/refresh-timer-cleanup.test.ts` around
lines 63 - 65, The test relies on SessionTokenCache clearing existing refresh
timers when a new token is set, but the current main omits that logic; update
the SessionTokenCache.set() implementation to cancel any existing refresh timer
for the same session/key before scheduling a new one (clearTimeout/clearInterval
on the stored timer reference), ensure the timer reference is stored on the
SessionTokenCache instance (e.g., a map of sessionId -> refreshTimer), and start
the new refresh timer only after cleaning up the previous one so orphaned timers
don't fire and the tokenRequests assertion passes; alternatively, if you
deliberately don't want the fix here, keep the test skipped/xfail in this branch
rather than merging it.
This PR exists solely to validate that the e2e test added in #TBD (
jacek/fix-token-cache-timer-leak) fails without the corresponding implementation changes.What's here
integration/tests/session-token-cache/refresh-timer-cleanup.test.ts— the new e2e test that verifies the token cache's proactive refresh timer does not accumulate orphaned timers acrossset()calls.What's NOT here
tokenCache.tsthat clears the previous timer before setting a new one.Expected outcome
This test should fail on CI, confirming that:
jacek/fix-token-cache-timer-leakare necessary for the test to passOnce validated, this PR should be closed without merging.
Summary by CodeRabbit